index.js ➔ ???   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 6

Duplication

Lines 0
Ratio 0 %

Importance

Changes 3
Bugs 0 Features 0
Metric Value
cc 2
c 3
b 0
f 0
nc 2
dl 0
loc 6
rs 9.4285
nop 0

1 Function

Rating   Name   Duplication   Size   Complexity  
A index.js ➔ ... ➔ ??? 0 1 1
1
'use strict'
2
3
import server from './server'
4
import chalk from 'chalk'
5
import logger from 'winston'
6
import config from '../config'
7
import databaseConnection, { databaseValidate } from './database'
8
import beforeServerListen from './cluster'
9
import endpoints from './helpers/endpoints'
10
11
// Verify `cluster` need
12
beforeServerListen(() => {
13
  if (config.isDevelop) {
14
    console.log(endpoints.listAll(server))
15
  }
16
  server.listen(config.server.port, () => databaseConnection(config.uri.db))
17
})
18
19
Promise.all([databaseValidate])
20
  .then(() => {
21
    logger.info('[app]', `Restify started in ${chalk.bold(config.env)}` +
22
                ` mode on ${chalk.cyan(server.url)}` +
23
                '; press Ctrl-C to terminate.')
24
  })
25
  .catch((error) => {
26
    if (error instanceof Error) {
27
      logger.error('[app]', error.stack)
28
    }
29
  })
30